import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
import One from '../tabs/One.vue'
import Two from '../tabs/Two.vue'
import Three from '../tabs/Three.vue'
import Home from '../tabs/Home.vue'
import HomeSon from '../tabs/HomeSon.vue'
import HomeSon1 from '../tabs/HomeSon1.vue'


Vue.use(VueRouter)

const routes = [
    //一级二级路由路径加path和不加path的区别
    //方法一:

    // {
    //     path: '/',
    //     name: 'home',
    //     component: Home,
    //     children: [
    //         { path: 'son', name: 'son', component: HomeSon },
    //         { path: 'son1', name: 'son1', component: HomeSon1 }
    //     ]
    // },
    //方法二:

    // {
    //     path: '/',
    //     name: 'home',
    //     component: Home,
    //     children: [
    //         { path: 'son', name: 'son', component: HomeSon },
    //         { path: 'son1', name: 'son1', component: HomeSon1 }
    //     ]
    // },

    //方法三:
    {
        path: '/home',
        name: 'home',
        component: Home,
        children: [
            { path: '/son', name: 'son', component: HomeSon },
            { path: '/son1', name: 'son1', component: HomeSon1 }
        ]
    },

    {
        path: '/one',
        name: 'One',
        component: One
    },
    {
        path: '/two/:age/:num',
        name: 'Two',
        component: Two
    },
    {
        path: '/three/:id',
        name: 'Three',
        component: Three
            // {
            //     path: '/about',
            //     name: 'About',
            //     // route level code-splitting
            //     // this generates a separate chunk (about.[hash].js) for this route
            //     // which is lazy-loaded when the route is visited.
            //     component: () =>
            //         import ( /* webpackChunkName: "about" */ '../views/About.vue')
            // }
    }
]

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})

export default router